﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OWANotifier
{
    public partial class LoginForm : Form
    {
        public string Username
        {
            get
            {

                return txtUsername.Text;
            }
            set
            {
                txtUsername.Text = value;
            }
        }

        public string Password
        {
            get
            {

                return txtPassword.Text;
            }
            set
            {
                txtPassword.Text = value;
            }
        }

        public bool RememberPassword
        {
            get
            {
                return chkRememberPassword.Checked;
            }
            set
            {
                chkRememberPassword.Checked = value;
            }
        }

        public bool IntegratedSecurity
        {
            get
            {
                return chkIntegratedSecurity.Checked;
            }
            set
            {
                chkIntegratedSecurity.Checked = value;
            }
        }


        private string server;

        public string Server
        {
            get { return server; }
            set
            {
                server = value;

                lblConnectingTo.Text = "Connecting To " + server;
                Text = "Connect To " + server;
            }
        }


        public LoginForm()
        {
            InitializeComponent();
        }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            txtPassword.Focus();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {

        }

        private void chkIntegratedSecurity_CheckedChanged(object sender, EventArgs e)
        {
            txtUsername.Enabled = !chkIntegratedSecurity.Checked;
            txtPassword.Enabled = !chkIntegratedSecurity.Checked;
            chkRememberPassword.Enabled = !chkIntegratedSecurity.Checked;

            if (chkIntegratedSecurity.Checked)
                txtUsername.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
        }
    }
}
